﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Users/MasterPage.master" AutoEventWireup="true" CodeFile="TicketDetail.aspx.cs" Inherits="Users_TicketDetail" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h3 align="center">Ticket Detials</h3>
<div>
    <asp:DataList ID="DataList1" runat="server" DataKeyField="TicketID" 
        DataSourceID="SqlDataSource1" Width="100%">
        <ItemTemplate>
            <b>Ticket : </b>
            <br />
            Ticket ID:
            <asp:Label ID="TicketIDLabel" runat="server" Text='<%# Eval("TicketID") %>' />
            &nbsp;<br />
            Status:
            <asp:Label ID="TicketStatusLabel" runat="server" 
                Text='<%# Eval("TicketStatus") %>' />
            <br />
            Bought Day:
            <asp:Label ID="BoughtDayLabel" runat="server" 
                Text='<%# Eval("BoughtDay", "{0:t} {0:D}") %>' />
            <br />
            <br />
            <b>Flight :<br />
            </b>From :
            <asp:Label ID="fromCityLabel" runat="server" Text='<%# Eval("fromCity") %>' />
            ,
            <asp:Label ID="fromstateLabel" runat="server" Text='<%# Eval("fromstate") %>' />
            ,
            <asp:Label ID="fromcountryLabel" runat="server" 
                Text='<%# Eval("fromcountry") %>' />
            <br />
            To :
            <asp:Label ID="ToCityLabel" runat="server" Text='<%# Eval("ToCity") %>' />
            ,
            <asp:Label ID="tostateLabel" runat="server" Text='<%# Eval("tostate") %>' />
            ,
            <asp:Label ID="tocountryLabel" runat="server" Text='<%# Eval("tocountry") %>' />
            <br />
            Depart Time:
            <asp:Label ID="Depart_TimeLabel" runat="server" 
                Text='<%# Eval("[Depart Time]", "{0:t} {0:D}") %>' />
            <br />
            Airplane :
            <asp:Label ID="Plane_NameLabel" runat="server" 
                Text='<%# Eval("[Plane Name]") %>' />
            <br />
            <br />
        </ItemTemplate>
    </asp:DataList>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:sqlString %>" 
        SelectCommand="SELECT Airline_Ticket.TicketStatus, Airline_Ticket.BoughtDay, Airline_Ticket.TicketID, Airline_Flight.[Depart Time], Airline_Cities.[City Name] AS ToCity, Airline_Cities_1.[City Name] AS fromCity, Airline_Cities_1.Country AS fromcountry, Airline_Cities.Country AS tocountry, Airline_Cities.State AS tostate, Airline_Cities_1.State AS fromstate, Airline_Airplane.[Plane Name] FROM Airline_Route INNER JOIN Airline_Cities ON Airline_Route.DestinationCityID = Airline_Cities.CityID INNER JOIN Airline_Schedule ON Airline_Route.RouteID = Airline_Schedule.RouteID INNER JOIN Airline_Flight ON Airline_Schedule.SchedueID = Airline_Flight.ScheduleID INNER JOIN Airline_Airplane ON Airline_Flight.AirPlaneID = Airline_Airplane.AirPlaneID INNER JOIN Airline_Cities AS Airline_Cities_1 ON Airline_Route.OriginalCityID = Airline_Cities_1.CityID INNER JOIN Airline_Ticket ON Airline_Flight.FlightID = Airline_Ticket.FlightID WHERE (Airline_Ticket.TicketID = @TicketID)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="TicketID" 
                QueryStringField="id" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <b>Passenger</b><asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AllowSorting="True" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" 
        Width="100%">
        <Columns>
            <asp:BoundField DataField="First Name" HeaderText="First Name" 
                SortExpression="First Name" />
            <asp:BoundField DataField="Last Name" HeaderText="Last Name" 
                SortExpression="Last Name" />
            <asp:BoundField DataField="Age" HeaderText="Age" SortExpression="Age" />
            <asp:CheckBoxField DataField="IsMale" HeaderText="Male" SortExpression="IsMale">
            <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
            </asp:CheckBoxField>
            <asp:BoundField DataField="SeatClass" HeaderText="Seat Class" 
                SortExpression="SeatClass" />
            <asp:BoundField DataField="Price" DataFormatString="{0} USD" 
                HeaderText="Ticket Price" SortExpression="Price" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:sqlString %>" 
        SelectCommand="SELECT [First Name], [Last Name], Age, IsMale, SeatClass, Price, TicketID FROM Airline_TicketDetail WHERE (TicketID = @TicketID)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="0" Name="TicketID" 
                QueryStringField="id" />
        </SelectParameters>
    </asp:SqlDataSource>
    </div>
</asp:Content>

